

import {getPositionCategoryByPage} from "../components/baf/PositionCategoryManagement/PositionCategoryService";
import {searchListByKey} from "../commons/utils/CommonUtils";
import {listAllTree} from "../components/baf/Organization/OrganizationService";
import {listAllDataRoleGroup, listAllFeatureRoleGroup} from "../components/baf/Position/PositionService";
import {getAllCountry} from "../components/baf/Country/CountryService";
import {getAllList} from "../components/baf/AppModule/AppModuleService";
import {getAllAuthorizeEntityType} from "../components/baf/AuthorizeEntityType/AuthorizeEntityTypeService";
import {getAllFeatureByPage} from "../components/baf/Feature/FeatureService";
import {listAllTenantAppModules, listAllUserType} from "../components/baf/DataRole/DataRoleManagerService";
import {listFlowTaskApp} from "../components/homePage/service";
import {listAllBankCategory, listBankByCategoryId, listByBankCategory} from "../components/userSetting/service";
import {findTenantAllUnfrozen} from "../components/baf/dataDictionary/service";

/**
 * SearchTable
 */

//岗位类别
export const positionCategoryConfig = {
    columns: [{
        title: '代码',
        dataIndex: 'code',
        width: 140
    },
        {
            title: '名称',
            dataIndex: 'name',
        }],
    dataService: getPositionCategoryByPage,
    //searchService: searchListByKey,
    key: 'id',
    text: 'name'
};
//功能角色组
export const featureRoleGroupConfig = {
    columns: [{
        title: '代码',
        dataIndex: 'code',
        width: 140
    },
        {
            title: '名称',
            dataIndex: 'name',
        }],
    dataService: listAllFeatureRoleGroup,
    searchService: searchListByKey,
    key: 'id',
    text: 'name'
};
//数据角色组
export const dataRoleGroupConfig = {
    columns: [{
        title: '代码',
        dataIndex: 'code',
        width: 140
    },
        {
            title: '名称',
            dataIndex: 'name',
        }],
    dataService: listAllDataRoleGroup,
    searchService: searchListByKey,
    key: 'id',
    text: 'name'
};
//国家
export const countryConfig = {
    columns: [{
        title: '代码',
        dataIndex: 'code',
        width: 140
    },
        {
            title: '名称',
            dataIndex: 'name',
        }],
    dataService: getAllCountry,
    searchService: searchListByKey,
    key: 'id',
    text: 'name'
};
//应用模块
export const appModuleConfig = {
    columns: [{
        title: '代码',
        dataIndex: 'code',
        width: 140
    },
        {
            title: '名称',
            dataIndex: 'name',
        }],
    dataService: getAllList,
    searchService: searchListByKey,
    key: 'id',
    text: 'name'
};
//应用模块(租户)
export const tenantAppModulesConfig = {
    columns: [{
        title: '代码',
        dataIndex: 'code',
        width: 140
    },
        {
            title: '名称',
            dataIndex: 'name',
        }],
    dataService: listAllTenantAppModules,
    searchService: searchListByKey,
    key: 'id',
    text: 'name'
};
//租户未冻结
export const findTenantAllUnfrozenConfig = {
  columns: [{
    title: '代码',
    dataIndex: 'code',
    width: 140
  },
    {
      title: '名称',
      dataIndex: 'name',
    }],
  dataService: findTenantAllUnfrozen,
  searchService: (data,searchKey,params=["code","name"])=>searchListByKey(data,searchKey,params),
  key: 'code',
  text: 'name'
};

//权限对象类型
export const authorizeEntityTypeConfig = {
    columns: [{
        title: '实体类型',
        dataIndex: 'entityClassName',
        width: 140
    },
        {
            title: '名称',
            dataIndex: 'name',
        }],
    dataService: getAllAuthorizeEntityType,
    searchService: searchListByKey,
    key: 'id',
    text: 'name'
};

//功能项
export const featureConfig = {
    columns: [{
        title: '代码',
        dataIndex: 'code',
        width: 160
    },
        {
            title: '名称',
            dataIndex: 'name',
          width:160
        },
    {
      title: '应用模块',
      dataIndex: 'featureGroup.appModule.name',
      width: 180,
    }],
    dataService: getAllFeatureByPage,
    key: 'id',
    text: 'name'
};
//银行类别
export const bankCategoryConfig = {
  columns: [{
    title: '代码',
    dataIndex: 'code',
    width: 140
  },
    {
      title: '名称',
      dataIndex: 'name',
    }],
  dataService: listAllBankCategory,
  searchService: searchListByKey,
  key: 'id',
  text: 'name'
};
//银行
export const bankConfigByPage = {
  columns: [{
    title: '代码',
    dataIndex: 'code',
    width: 140
  },
    {
      title: '名称',
      dataIndex: 'name',
    }],
  dataService: listByBankCategory,
  key: 'id',
  text: 'name'
};
//银行
export const bankConfig = {
  columns: [{
    title: '代码',
    dataIndex: 'code',
    width: 140
  },
    {
      title: '名称',
      dataIndex: 'name',
    }],
  dataService: listBankByCategoryId,
  searchService: searchListByKey,
  key: 'id',
  text: 'name'
};

/**
 * TreeSelected
 */

//组织机构
export const organizationConfig = {
    service: listAllTree,
    key: 'id',
    text: 'name'
};

/**
 * Selected
 */
//用户类型
export const userTypeConfig = {
    service: listAllUserType,
    key: 'anEnum',
    text: 'remark'
};
//流程应用模块
export const flowTaskAppConfig = {
  service: listFlowTaskApp,
  key: 'businessModeId',
  text: 'businessModelName'
};
